home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1998 / MacHack 1998.toast / Sessions / STL / Slides / STL3.cp < prev    next >
Text File  |  1998-06-15  |  656b  |  37 lines

  1. // STL3.cp
  2. #include <iostream>
  3. #include <list>
  4. using namespace std;
  5. int main()
  6. {
  7.     typedef    list<char> MyList;
  8.     char    start[] = "machack";
  9.     MyList    l(start, start + strlen(start));
  10.  
  11.     ostream_iterator<char>    out(cout);
  12.     cout << "  start: ";
  13.     copy(l.begin(), l.end(), out);
  14.  
  15.     cout << "\nremoved: ";
  16.     l.remove('c');
  17.     copy(l.begin(), l.end(), out);
  18.  
  19.     cout << "\n sorted: ";
  20.     l.sort();
  21.     copy(l.begin(), l.end(), out);
  22.  
  23.     cout << "\n unique: ";
  24.     l.unique();
  25.     copy(l.begin(), l.end(), out);
  26.  
  27.     cout << "\nreverse: ";
  28.     l.reverse();
  29.     copy(l.begin(), l.end(), out);
  30.     cout << "\n";
  31. }
  32. //   start: machack
  33. // removed: mahak
  34. //  sorted: aahkm
  35. //  unique: ahkm
  36. // reverse: mkha
  37.